Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethereumjs/common

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethereumjs/common

Resources common to all Ethereum implementations

  • 4.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
596K
decreased by-20.19%
Maintainers
4
Weekly downloads
 
Created

What is @ethereumjs/common?

@ethereumjs/common is a JavaScript library that provides common Ethereum constants, parameters, and functions. It is used to define and manage chain and hardfork parameters, making it easier to work with different Ethereum networks and their respective upgrades.

What are @ethereumjs/common's main functionalities?

Chain and Hardfork Parameters

This feature allows you to define and manage chain and hardfork parameters. The code sample demonstrates how to create a Common instance for the Ethereum mainnet with the 'istanbul' hardfork.

const Common = require('@ethereumjs/common').default;
const mainnetCommon = new Common({ chain: 'mainnet', hardfork: 'istanbul' });
console.log(mainnetCommon.chainName()); // 'mainnet'
console.log(mainnetCommon.hardfork()); // 'istanbul'

Custom Chains

This feature allows you to define custom chain parameters. The code sample demonstrates how to create a Common instance for a custom chain with specific chain and network IDs.

const Common = require('@ethereumjs/common').default;
const customChainParams = { name: 'custom', chainId: 1234, networkId: 1234 };
const customCommon = Common.forCustomChain('mainnet', customChainParams, 'istanbul');
console.log(customCommon.chainId()); // 1234

EIP Activation

This feature allows you to check if a specific Ethereum Improvement Proposal (EIP) is activated for a given hardfork. The code sample demonstrates how to check if EIP-1559 is activated for the 'berlin' hardfork.

const Common = require('@ethereumjs/common').default;
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' });
console.log(common.isActivatedEIP(1559)); // true or false depending on the EIP and hardfork

Other packages similar to @ethereumjs/common

Keywords

FAQs

Package last updated on 15 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc